﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace WPFGame.Windows
{
    /// <summary>
    /// UserControl4.xaml 的交互逻辑
    /// </summary>
    public partial class UserControl4 : UserControl
    {
        int count = 1;
        Image spirit;
        public UserControl4()
        {
            InitializeComponent();
            spirit = new Image() { Width = 150, Height = 150 };
            c.Children.Add(spirit);
            DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(100) };
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
        }

        void timer_Tick(object sender, EventArgs e)
        {
            spirit.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + @"\Players\J\130\run\" + count + ".png", UriKind.Absolute));
            count = count == 12 ? 1 : count + 1;
        } 
    }
}
